package com.crealth.crmserver;


//import org.apache.log4j.Logger;
import org.apache.mina.core.session.IoSession;

import com.crealth.handler.ResponseMsgQueue;
import com.crealth.msg.NetMessageData;

public class ResponseMsgThread extends Thread {
	//private static Logger logger = Logger.getLogger("running_log");
	//private static Logger errorLog = Logger.getLogger("error_log");	
	
	@Override
    public void run() {		
		NetMessageData msg = ResponseMsgQueue.getResponseMsg();
		if (msg != null && msg.getUserID() > 0) {
			int userID = msg.getUserID();
			//int cmd = msg.getMsgCmd();			
			IoSession session = SessionManager.getUserSessionByID(userID);
			if (session != null && session.isConnected()) {
				//logger.info("send Response userID: " + userID +"  cmd:" + cmd);
				session.write(msg);
			}				
		}			
	}
	
}
